package com.laamella.syntherface.synths.gui;

import com.laamella.syntherface.synths.models.ParameterModel;
import javax.swing.JLabel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 * 
 * @author danny
 */
@SuppressWarnings("serial") public class ParameterValueLabel extends JLabel {

	/** Creates new form ParameterValueLabel */
	public ParameterValueLabel() {
		setOpaque(false);
		setText("*** no model set ***");
	}

	public void setModel(final ParameterModel parameterModel) {
		setText(parameterModel.getFormattedValue());
		parameterModel.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent changeEvent) {
				setText(parameterModel.getFormattedValue());
			}
		});
	}
}
